' Do a find and replace for zs_SSIS_CCO_DB_RN with the name of the job you setup


result = Msgbox("Do you want to run the SSIS Package?", VBYesNo, "SQL a SQL Server Agent Job")

Select Case result

Case VBYes


'Connection String Required to connect to SQL Server or other DB
connectionString = "Provider=SQLOLEDB.1;password=;Persist Security Info=True;User ID=;Initial Catalog=MSDB;Data Source=;" 


'SQL statement to be executed
sql = "SET NOCOUNT ON DECLARE @JobStatus INT DECLARE SET @JobStatus = 0 EXEC MSDB.dbo.sp_start_job @Job_Name = 'zs_SSIS_CCO_DB_RN', @output_flag = 0 WAITFOR DELAY '00:00:01' SELECT @JobStatus = current_execution_status  FROM OPENROWSET('SQLNCLI', 'Server=localhost;Trusted_Connection=yes;','EXEC MSDB.dbo.sp_help_job @job_name = ''zs_SSIS_CCO_DB_RN'', @job_aspect = ''JOB'' ') WHILE @JobStatus <> 4 BEGIN	WAITFOR DELAY '00:00:03'	SELECT @JobStatus = current_execution_status  FROM OPENROWSET('SQLNCLI', 'Server=localhost;Trusted_Connection=yes;','EXEC MSDB.dbo.sp_help_job @job_name = ''zs_SSIS_CCO_DB_RN'', @job_aspect = ''JOB'' ')	END select b.message as Results2 from (select max(a.instance_id) as maxinstance, b.name from sysjobhistory a, sysjobs b where a.step_name like '(Job outcome)' and a.job_id = b.job_id and b.name like 'zs_SSIS_CCO_DB_RN' group by b.name) a, sysjobhistory b where a.maxinstance = b.instance_id"

set cn = createobject("adodb.connection") 
set cmd = createobject("adodb.Command")

on error resume next

'Open Connection
cn.open connectionString


If Err.Number = 0 Then 

'Associated connection object with command object
cmd.ActiveConnection = cn

cmd.CommandText = sql

'Execute Query
Set rs = cmd.EXECUTE

wscript.echo rs.fields("Results2")

cn.close

Else
     WScript.Echo "You cannot access the server. It may not exist, please check the connection string."
 End If

On Error GoTo 0


Case No
wscript.quit

end select